<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <style>
    *{
      padding: 0;
      margin: 0;
    }
    div{
      width: 200px;
      height: 200px;
      background: pink;
    }
  </style>
</head>
<body>
<div></div>
<script>
  flag=0;
  var div=document.querySelector('div');
  div.onclick=function () {
    if(flag==0){
      div.style.width='250px';
      div.style.backgroundColor='purple';
      flag=1;
    }else{
      div.style.width='200px';
      div.style.backgroundColor='pink';
      flag=0;
    }

  }
</script>
</body>
</html>
